Skip to content

generator-go-sdk - Generate date functions from ancestors#5391

Open
QixiaLu wants to merge 2 commits into
hashicorp:mainfrom
QixiaLu:fix-multi-layer-date-time-parse
Open

generator-go-sdk - Generate date functions from ancestors#5391
QixiaLu wants to merge 2 commits into
hashicorp:mainfrom
QixiaLu:fix-multi-layer-date-time-parse

Conversation

@QixiaLu

@QixiaLu QixiaLu commented May 12, 2026

Copy link
Copy Markdown
Contributor

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

This PR fixes date functions for multi-level discriminated types:

codeForDateFunctions used c.model.ParentTypeName (immediate parent) to find DateTime fields, while structLinesForModel uses findModelAncestry() to determine which ancestor fields to include on the struct. In 3+ level discriminated hierarchies, this mismatch causes compile errors when an intermediate parent has DateTime fields that aren't on the struct

PR Checklist

  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so, please include appropriate closing keywords below.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.

Changes to Tooling

  • I have added an explanation of what my changes do and why I'd like you to include them.
  • I have written new tests for my changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges.

Testing Command(s) Used:

# e.g., go test ./tools/generator-go-sdk/...

Testing Evidence:

Relevant successful SDK builds:
https://github.com/hashicorp/pandora/actions/runs/25717383360/job/75510290144
https://github.com/hashicorp/pandora/actions/runs/25717383334/job/75510290097
https://github.com/hashicorp/pandora/actions/runs/25717383350/job/75510290055

Previous problematic Data Plane SDK builds succeeds now:
image

Related Issue(s)

Fixes #5369

AI Assistance Disclosure

  • AI Assisted - This contribution was made by, or with the assistance of, AI/LLMs

Note

If this PR changes meaningfully during the course of review, please update the title and description as required.

@QixiaLu QixiaLu marked this pull request as ready for review May 12, 2026 07:50

@wuxu92 wuxu92 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @QixiaLu LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK generator loses intermediate ancestors in multi-level discriminated hierarchies

2 participants